#include <bits/stdc++.h>
using namespace std;
int n, m;
bool a[10010];
int main()
{
	cin >> n >> m;
	int b = 0;
	a[0] = 1;
	for(int i = 1; ;i++)
	{
		if(i > n)
			i = 0;
		if(a[i] == 0)
			b++;
		if(b == m)
		{
			cout << i << " ";
			a[i] = 1;
			b = 0;
		}
		bool cheak = 0;
		for(int i = 1; i <= n; i++)
			if(a[i] == 0)
				cheak = 1;
		if(cheak == 0)
			break;
	}
	return 0;
}